<?php

use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
/*
Route::get('/', function () {
    return view('welcome');
});*/

Route::namespace('Admin')->group(function () {
    //登录页面
    Route::any('admin/login', 'LoginController@login')->name('admin.login');
    Route::post('admin/dologin', 'LoginController@dologin')->name('admin.dologin');
    Route::any('admin/loginout', 'LoginController@loginout')->name('admin.loginout');
    //清空缓存
    Route::any('admin/clear_cache', 'IndexController@clear_cache')->name('admin.clear_cache');
    //adminlogin 后台登录验证中间件
    Route::middleware(['adminlogin','adminauth'])->group(function(){
        //首页
        Route::get('admin', 'IndexController@index')->name('admin');
        Route::get('admin/index', 'IndexController@index')->name('admin.index');
        //欢迎页面（数据统计）
        Route::get('admin/welcome', 'IndexController@welcome')->name('admin.welcome');
        
        /***************************************系统管理 begin***************************************/
        //管理员管理
        Route::any('admin/admin/index', 'AdminController@index')->name('admin.admin.index');
        Route::any('admin/admin/add', 'AdminController@add')->name('admin.admin.add');
        Route::any('admin/admin/edit', 'AdminController@edit')->name('admin.admin.edit');
        Route::post('admin/admin/delete', 'AdminController@delete')->name('admin.admin.delete');
        Route::any('admin/admin/reset_pwd', 'AdminController@reset_pwd')->name('admin.admin.reset_pwd');

        Route::any('admin/admin/update_pwd', 'AdminController@update_pwd')->name('admin.admin.update_pwd');

        //角色管理
        Route::any('admin/role/index', 'RoleController@index')->name('admin.role.index');
        Route::any('admin/role/add', 'RoleController@add')->name('admin.role.add');
        Route::any('admin/role/edit', 'RoleController@edit')->name('admin.role.edit');
        Route::post('admin/role/delete', 'RoleController@deleteRole')->name('admin.role.delete');

        //菜单管理
        Route::any('admin/menu/index', 'MenuController@index')->name('admin.menu.index');
        Route::any('admin/menu/add', 'MenuController@add')->name('admin.menu.add');
        Route::any('admin/menu/edit', 'MenuController@edit')->name('admin.menu.edit');
        Route::post('admin/menu/delete', 'MenuController@delete')->name('admin.menu.delete');
        Route::any('admin/menu/update_status', 'MenuController@update_status')->name('admin.menu.update_status');

        //商户菜单管理
        Route::any('admin/merchant_menu/index', 'MerchantMenuController@index')->name('admin.merchant_menu.index');
        Route::any('admin/merchant_menu/add', 'MerchantMenuController@add')->name('admin.merchant_menu.add');
        Route::any('admin/merchant_menu/edit', 'MerchantMenuController@edit')->name('admin.merchant_menu.edit');
        Route::post('admin/merchant_menu/delete', 'MerchantMenuController@delete')->name('admin.merchant_menu.delete');
        Route::post('admin/merchant_menu/update_status', 'MerchantMenuController@update_status')->name('admin.merchant_menu.update_status');
        Route::post('admin/merchant_menu/update_show', 'MerchantMenuController@update_show')->name('admin.merchant_menu.update_show');

        //系统登录日志
        Route::any('admin/admin_loginlog/index', 'AdminLoginlogController@index')->name('admin.admin_loginlog.index');
        //系统操作日志
        Route::any('admin/admin_actionlog/index', 'AdminActionlogController@index')->name('admin.admin_actionlog.index');
        //系统操作日志导出
        Route::any('admin/admin_actionlog/export', 'AdminActionlogController@export')->name('admin.admin_actionlog.export');
        
        //系统操作日志导入测试
        Route::any('admin/admin_actionlog/import', 'AdminActionlogController@import')->name('admin.admin_actionlog.import');
        
        
        //图片管理
        Route::any('/admin/image/index', 'ImageController@index')->name('admin.image.index');
        

        /***************************************系统管理 end***************************************/
    });
});

Route::namespace('Index')->group(function () {
    //测试队列
    Route::any('/index/job', 'JobController@index')->name('index.job');
});
    
/***************************************图片控件 begin***************************************/
Route::namespace('Image')->group(function () {
    //图片弹出框
    Route::any('/image/index', 'ImageController@index')->name('image.index');
    //添加图片分组
    Route::any('/image/add_group', 'ImageController@add_group')->name('image.add_group');
    //删除图片分组
    Route::any('/image/delete_group', 'ImageController@delete_group')->name('image.delete_group');
    //更新图片分组排序
    Route::any('/image/update_group', 'ImageController@update_group')->name('image.update_group');
    
    //上传图片
    Route::post('/image/upload', 'ImageController@upload')->name('image.upload');
    //删除图片
    Route::post('/image/delete_img', 'ImageController@delete_img')->name('image.delete_img');
});
    /***************************************图片控件 end***************************************/